<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  
  <results>
	  <xsl:for-each select="//test">
		<xsl:if	test="starts-with(tags/tag[starts-with(text(),'testlink')],'testlink')">
			<testcase external_id="{substring-after(tags/tag[starts-with(text(),'testlink')],'testlink_')}">
				<tester>robotframework</tester>
				<xsl:choose>
					<xsl:when test="status/@status ='PASS'">
						<result>p</result>
						<notes>Executed automatically using Robot Framework.</notes>
					</xsl:when>
					<xsl:otherwise>
						<result>f</result>
						<notes><xsl:value-of select="status"/>

Executed automatically using Robot Framework.</notes>
					</xsl:otherwise>
				</xsl:choose>	
			</testcase>
		</xsl:if>
	  </xsl:for-each>
  </results>
  
</xsl:template>

</xsl:stylesheet> 